VT-d: various initialization fixes
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 11 Mar 2010 17:15:54 +0000 (17:15 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 11 Mar 2010 17:15:54 +0000 (17:15 +0000)
commit8343b1c548720a423101c278f7a070a1e8ace94d
treea2af800d7bc08c96ade7c782faf429b4ee9dbc12
parent01046a5b39339d278e6d8b55ee32d462d63092da
VT-d: various initialization fixes

Detect invalid/unsupported configurations in iommu_alloc() - offsets
read from hardware must not lead to exceeding a single page (since
only that much gets mapped). This covers the apparently not uncommon
case of the address pointed to by a DMAR reading as all ones (Linux
for example also checks for this).

Further correct error handling of that function: Without storing the
allocated "struct iommu" instance in the drhd, iommu_free() won't do
anything, and hence all successfully set up pieces would be leaked.

Also keep iommu_free() from calling destroy_irq() when no irq was
ever set up.

Additionally, clear_fault_bits() has no need to read the capabilities
field from I/O memory - it's already cached in "struct iommu".

Finally, simplify print_iommu_regs() and its output, and actually use
this function.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen/drivers/passthrough/vtd/iommu.c
xen/drivers/passthrough/vtd/utils.c